﻿#region

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using CuongHanh.Context;

#endregion

namespace CuongHanh.Models
{
    [Table("tbl_User")]
    public class User
    {
        public User()
        {
        }

        public User(User model)
        {
            Username = model.Username;
            Password = model.Password.GetMd5();
            Inactive = false;
            LastModified = DateTime.Now;
        }

        public int Id { get; set; }

        [Required]
        public string Username { get; set; }

        [Required]
        public string Password { get; set; }

        [Required]
        public bool? RememberMe { get; set; }

        public bool Inactive { get; set; }

        public DateTime LastModified { get; set; }

        public void UpdateInfo(User model)
        {
            Username = model.Username;
            Password = model.Password.GetMd5();
            LastModified = DateTime.Now;
        }
    }
}
